package Icr.RegisteredAssistant;

import java.util.Locale;

import Icr.RegisteredAssistant.Controller.CompanyController;
import Ping.Help.DatabaseHelp;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

import android.widget.Button;

public class RegisteredCompanyAssistantActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		/*
		 * Database_path = /data/data/Ping.Test/databases/ app_name =
		 * radatabase.db3
		 */

		if (Locale.getDefault().getLanguage().toLowerCase()
				.equals("zh".toLowerCase())) {
			if (Locale.getDefault().toString().toLowerCase()
					.equals("zh_TW".toLowerCase())) {
				DatabaseHelp.init(this, R.raw.dbtw,
						getString(R.string.Database_path),
						getString(R.string.Database_Name));
			} else {
				DatabaseHelp.init(this, R.raw.db,
						getString(R.string.Database_path),
						getString(R.string.Database_Name));
			}
		} else {
			DatabaseHelp.init(this, R.raw.dben2,
					getString(R.string.Database_path),
					getString(R.string.Database_Name));
		}

		try {
			CompanyController.Init();
		} catch (Exception e) {
			// TODO: handle exception
		}

		BindButton();

	}

	private void BindButton() {
		((Button) findViewById(R.id.RegistrationGuidelines))
				.setOnClickListener(new OnClickListener() {

					public void onClick(View v) {
						// TODO Auto-generated method stub

						ComponentName component = new ComponentName(
								RegisteredCompanyAssistantActivity.this,
								GuideListActivity.class);
						Intent intent = new Intent();

						intent.setComponent(component);
						startActivity(intent);

					}
				});

		((Button) findViewById(R.id.InquiresTheCompany))
				.setOnClickListener(new OnClickListener() {

					public void onClick(View v) {
						// TODO Auto-generated method stub

						ComponentName component = new ComponentName(
								RegisteredCompanyAssistantActivity.this,
								CompanyFindActivity.class);
						Intent intent = new Intent();

						intent.setComponent(component);
						startActivity(intent);

					}
				});
	}
}